package com.zhiwang.planet.ui.my

import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexWrap
import com.google.android.flexbox.FlexboxLayoutManager
import com.google.android.flexbox.JustifyContent
import com.zhiwang.planet.R
import com.zhiwang.planet.databinding.ActivityChangeAvatarBinding
import com.zhiwang.planet.di.component.DaggerUserComponent
import com.zhiwang.planet.di.module.AccountModule
import com.zhiwang.planet.di.module.AutoDisposeModule
import com.zhiwang.planet.mvvm.viewmodel.my.ChangeAvatarViewModel
import com.zhiwang.planet.ui.BaseActivity
import kotlinx.android.synthetic.main.activity_change_avatar.*
import javax.inject.Inject

class ChangeAvatarActivity : BaseActivity() {


    @Inject
    lateinit var avatarViewModel: ChangeAvatarViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = DataBindingUtil.setContentView<ActivityChangeAvatarBinding>(this, R.layout.activity_change_avatar)
        binding.viewModel = avatarViewModel
        binding.lifecycleOwner = this
        setSupportActionBar(toolbar)

        avatarViewModel.context = this
        recyclerView.layoutManager = GridLayoutManager(this, 4)
        avatarViewModel.load()
    }


    override fun initInjection() {
        super.initInjection()
        DaggerUserComponent.builder()
                .accountModule(AccountModule(this))
                .appComponent(getAppComponent())
                .autoDisposeModule(AutoDisposeModule(this))
                .build()
                .inject(this)
    }

}